package kr.ac.kookmin.cs.random;

import java.math.BigInteger;

import kr.ac.kookmin.cs.randomtest.RandomNumberSequenceGenerator;

public class LCG extends RandomNumberSequenceGenerator{

	private BigInteger next = new BigInteger("0");
	private static final BigInteger A = new BigInteger("279470273");
	private static final BigInteger B = new BigInteger("4294967291");
	
	public LCG(){
		super();
		super.maximumIntegerValue = 4294967295L;
	}
	
	@Override
	public void initialize(long seed){
		super.initialize(seed);
		next = new BigInteger(Long.toString(getSeed()));
	}

	@Override
	protected long getNextRandomNumber() {
		next = A.multiply(next).mod(B);
		return next.longValue();
	}

	@Override
	protected long getRandomNumberWithSeed(long seed) {
		initialize(seed);
		next = A.multiply(next).mod(B);
		return next.longValue();
	}

}
